package makecode

import (
	"gitee.com/ichub/gofactroy/common/ichubbase"
	"gitee.com/ichub/gofactroy/factroy/buildfactroy"
	"gitee.com/ichub/gofactroy/factroy/dbfactroy"
	_ "github.com/go-sql-driver/mysql"
	_ "github.com/jinzhu/gorm/dialects/postgres"
)

func MakeCock() {

	tabletool := &dbfactroy.DbFactroy{
		Author:       "leijianming",
		Dbtype_mysql: false,
		Db:           ichubbase.MODULE_MAP[ichubbase.APP].DBNAME,
		Table:        "hub_levels",
		ModuleName:   ichubbase.MODULE_MAP[ichubbase.APP],
		DBUrl:        "postgresql://test:123456@192.168.13.235:26257/" + ichubbase.MODULE_MAP[ichubbase.APP].DBNAME + "?sslmode=require",
		//DBUrl:        "postgresql://root@192.168.14.153:26257/" + ichubbase.MODULE_MAP[ichubbase.APP].DBNAME + "?sslmode=disable",
	}

	dbinst := tabletool.IniAll()
	defer dbinst.Close()
	tool := &buildfactroy.BuildGoFactroy{DbFactroy: tabletool}

	//var entity model.TableName1
	//entity.AutoMigrate(dbcontent.GetDB())
	//单表生成
	//tool.BuildTable()
	//全表生成
	tool.BuildTables()

	//多表关联
	//func() {
	//	multiQuery := &build.JoinQuery{}
	//	multiQuery.Ini(tabletool, "cms_column,cms_content").CheckTables()
	//	multiQuery.SelectFields("cms_column.column_id,cms_content.content_id")
	//	multiQuery.Keys["cms_column.column_id"] = "cms_content.content_id"
	//	multiQuery.Build(tabletool)
	//}()

}
